<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人信息</title>
    <script src="./js/setupin.js"></script>
    <script src="./js/axios.js"></script>
</head>

<script setup>
    import {ref} from 'vue'

    const userInfo = ref({})
    axios.get('http://localhost:8080/getUser')
        .then(res => {
            userInfo.value = res.data
        })

    const logout = () => {
        axios.delete('http://localhost:8080/delUser')
        window.location.href = 'http://localhost:8080/index.html'
    }
</script>

<template>
    <h1>个人信息</h1>
    <img :src="userInfo.headimgurl" alt="">
    <div>{{userInfo.nickname}}</div>

    <button @click="logout">退出登录</button>
</template>
</html>